package com.lighting.module4.service;

import com.lighting.module4.dto.Calculator;

import java.text.NumberFormat;
import java.util.Locale;

/**
 * 业务逻辑接口
 */
public interface CalculatorService {
    public default String[] CreateRow(int i, double payment, double payPrincipal, double payInterest, double p) {
        String[] row = new String[]{
                (i + 1) + "",
                NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment),
                NumberFormat.getCurrencyInstance(Locale.CHINA).format(payPrincipal),
                NumberFormat.getCurrencyInstance(Locale.CHINA).format(payInterest),
                NumberFormat.getCurrencyInstance(Locale.CHINA).format(p)
        };
        return row;
    }

    public abstract String[] cal(Calculator c);
    public  abstract String[][] details(Calculator c);
}
